package com.manor.paradise.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.manor.paradise.R
import com.manor.paradise.bean.ReikindexBean
import com.manor.common.utils.GlideUtil
import kotlinx.android.synthetic.main.lyb_item_active_index.view.*

class LybActiveIndexAdapter(data: MutableList<ReikindexBean.RecordsBean>?) : BaseQuickAdapter<ReikindexBean.RecordsBean, BaseViewHolder>(R.layout.lyb_item_active_index, data) {

    init {
        addChildClickViewIds(R.id.sPhoneIv)
    }
    override fun convert(holder: BaseViewHolder, item: ReikindexBean.RecordsBean) {
        GlideUtil.loadImage(item.avatar, holder.itemView.sAvatarIv, 30, 30)
        holder.itemView.sNickNameTv.text = "淘米号 " + item.serialNo
        holder.itemView.sTimeTv.text = item.createTime
        holder.itemView.sPersonalActiveTv.text = item.anima
        holder.itemView.sTeamActiveTv.text = item.teamLiveness
        holder.itemView.sYiyangzhiYiyaoqingTv.text = item.lowerCountString
        when (item.star) {
            "-1" -> {
                holder.itemView.sStarTv.text = "无等级"
                holder.itemView.sStarIv.setBackgroundResource(R.drawable.star_no)
            }
            "0" -> {
                holder.itemView.sStarTv.text = "一星农场主"
                holder.itemView.sStarIv.setBackgroundResource(R.drawable.star1_lighten_l)
            }
            "1" -> {
                holder.itemView.sStarTv.text = "二星农场主"
                holder.itemView.sStarIv.setBackgroundResource(R.drawable.star2_lighten_l)
            }
            "2" -> {
                holder.itemView.sStarTv.text = "三星农场主"
                holder.itemView.sStarIv.setBackgroundResource(R.drawable.star3_lighten_l)
            }
            "3" -> {
                holder.itemView.sStarTv.text = "四星农场主"
                holder.itemView.sStarIv.setBackgroundResource(R.drawable.star4_lighten_l)
            }
        }
    }
}